/*
 * logic_public.h
 *
 *  Created on: 2025年5月21日
 *      Author: chenm
 */

#ifndef LOGIC_PUBLIC_H_
#define LOGIC_PUBLIC_H_
#include "bsp_register_map.h"
#include <stdio.h>
#include "string.h"
#include "system_S32K118.h"
#include "interrupt_manager.h"
#include "cola_init.h"
#include "cola_device.h"
#include "cola_os.h"
#include "cola_fifo.h"
#include "fml_gpio.h"
#include "fml_pwm.h"
#include "fml_PMIC.h"
#include "fml_tft.h"
#include "fml_flash.h"
#include "fml_adc.h"
#include "fml_ds90ub948.h"
#include "fml_max25512.h"
#include "version.h"


typedef enum
{
	EN_NOTIFY_NONE = 0,
	EN_NOTIFY_SYS_POWER_DOWN 	= 0x01,	//通知系统已下电
	EN_NOTIFY_SYS_POWER_UP		= 0x02,	//通知系统上电
	EN_NOTIFY_VOLTAGE_NORMAL	= 0x04, //通知系统电压正常
	EN_NOTIFY_VOLTAGE_HIGH		= 0x08,	//通知系统高压异常
	EN_NOTIFY_VOLTAGE_LOW		= 0x10,	//通知系统低压异常
}eNotifyEvent;

#define B_partion_address 		0x00024000
#define A_partion_address 		0x00008000

#if 1
//规范要求值:
#define VOLTAGE_LOW_IN          8500     		// 低压进入电压
#define VOLTAGE_LOW_OUT        	9500     		// 低压退出电压

#define VOLTAGE_NORMAL_MIN      9500     		// 正常电压最小电压
#define VOLTAGE_NORMAL_MAX      16000     		// 正常电压最大电压

#define VOLTAGE_HIGH_IN         16500     		// 高压进入电压
#define VOLTAGE_HIGH_OUT        16000     		// 高压退出电压
#else
//这几个值用于做实验
#define VOLTAGE_LOW_IN          9500     		// 低压进入电压
#define VOLTAGE_LOW_OUT        	10000     		// 低压退出电压

#define VOLTAGE_NORMAL_MIN      10000     		// 正常电压最小电压
#define VOLTAGE_NORMAL_MAX      15000     		// 正常电压最大电压

#define VOLTAGE_HIGH_IN         15500     		// 高压进入电压
#define VOLTAGE_HIGH_OUT        15000     		// 高压退出电压
#endif
void ReceiveData(uint8_t *pBuf);

extern void logWrite(const char *fmt, ...);
extern void fml_max25512_init(void);
extern void fml_max25512_set_bklight_on(bool bON);
extern void logic_process_bist_mode(bool bEnable);
extern void fml_tft_BIST_clear(void);
extern void fml_set_host_pwm_value(int value);
extern int fml_get_host_pwm_value(void);

#endif /* LOGIC_PUBLIC_H_ */
